import Taro from '@tarojs/taro'
import { PAY_EXCHANGE_BATTERY_PENDING, PAY_EXCHANGE_BATTERY_REJECT, PAY_EXCHANGE_BATTERY_RESOLVE } from './../constants/pay';

const INITIAL_STATE = {

}

export default function pay (state = INITIAL_STATE, action) {
  switch(action.type) {
    case PAY_EXCHANGE_BATTERY_PENDING:
      return state
    case PAY_EXCHANGE_BATTERY_RESOLVE:
      Taro.redirectTo({
        url: '/pages/pay/PaySuccess?type=' + action.payType
      })
      return state
    case PAY_EXCHANGE_BATTERY_REJECT:
      return state
    default:
      return state
  }
}
